let IsTest =0;
// "119.29.41.81"||
let host =  "127.0.0.1";

let userName = IsTest ? 'imdb' : "root";
let password = IsTest ? "swA8nbR4rRPTxLmc" : "";
let database = "imdb";

var mysql = require('mysql');
var connection = mysql.createPool({
	host: host,
	user: userName,
	password: password,
	database: database || 'imdb',
	charset: 'utf8mb4', // 设置编码格式为UTF-8
});
//数据库 增删改查数据 params Array
const shsDB = (str, params) => {
	var promise = new Promise((resolve, reject) => {
		connection.query(str, params, (err, data, fields) => {
			if (err) {
				reject(err);
			} else {
				resolve(data);
			}
		});
	});
	return promise;
};
module.exports = shsDB;